package com.foldingleaf.web.controller.order.pay;


import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayTradeAppPayRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;


public class AlipayConfig {

    @Autowired
    private YmlParament ymlParament;

    /**
     * 设置支付宝客户端
     * @return
     */
    @Bean
    public AlipayClient setAlipayClient() {
        return new DefaultAlipayClient(
                "https://openapi.alipay.com/gateway.do",
               "2021002117682546",
                "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCwjW0zhNW2n0FHRE3AtBzXcI2gO5I0rorvhkYJ9h4X2sU8+sN4YQAR2bin/qY+nyMyOFaKcPHLgZ3C98EU7ihzaY7sgiIa+X+6F9+/3oc1oV0L2u12qTbWDpSb2blPnJyK5gcZ0oufRMWfTLHXgv8pqIgr4fEsTQW9sGj/A9B4MeLNe7qNtG6F8REHmvMFVGFfXfDXwczHNBW+h70liW7wrRPf9a2I7Jh8ddoJhBz+qp4n45Y5widoOwuuIXz2WvuI5ky4diS5SuOT9i/4qRC3hiZ59VQfCfIdK0LHg4ZwDCggIajItAWujODvef5fRTiBxPDlNYRn1f7db718U6G9AgMBAAECggEBAJVUifDxgfIdcZFd7IX50gtHYAMPX/K/TzSZVdRHH9z9ZabWU08WfICcrtspQGPnJlXr4Qbn0RxYXZ/y/pU9e2li90iEKWS3c5lraA1ZovNxsMm+OuwK5B7Z5kiMN3lm9eFl/suQkhf8i0raC/JFEp2htsunJ95Yp2pyM9y+1S1TW+lQWT+J6sr/1bMYPRUcK9ofDtaQdlcX9V07NaQSGfjDyiFgKe/xnNDDsMxvryXTlUGWlDYlLLqmRxgLj0HRFPgzKP56loZEpeG5jbAgB9hXIAV9aA4sLANPqrdoSrmN2k1CZLmUaKpcKo7MGJjdvOceKt00vQYjv/ngB3BNouECgYEA5PfdgZBqo0QZh7NfubA/+WNy1iAnaF33yARHfMtPQToXxdRBi6tgD0ks/34oN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lacDzIm13MhomyQVKmUzus0Z6Ap8I57dYmNqYMq8YXgtxzh950PvEw2kc01aWYwpM4WooACBCc3myLVx97QdGJDFVn2pktRSKueWQ0jzpHIHdvRxOYQ0gngZk4z10c8Sma0ybaUX0kCI2aoiwwIDAQAB",
                "RSA2"
        );
    }

    /**
     * App支付请求公共参数
     * 参考官方链接：https://opendocs.alipay.com/open/54/106370
     * @return
     */
    @Bean
    public AlipayTradeAppPayRequest setAlipayTradeAppPayRequest () {
        return new AlipayTradeAppPayRequest();
    }





}
